/*
 * @Description: 
 * @Author: zml
 * @Date: 2025-07-28 12:07:31
 * @LastEditors: zml
 * @LastEditTime: 2025-07-31 12:11:33
 */

import Login from "../pages/Login"
import Home from "../pages/Home"
import About from "../pages/About"
import NotFound from "../pages/404"
import LayoutIndex from "../layout"
import MenuAdmin from "../pages/System/MenuAdmin"
import PowerAdmin from "../pages/System/PowerAdmin"
import RoleAdmin from "../pages/RoleSystem/RoleAdmin"
import UserAdmin from "../pages/RoleSystem/UserAdmin"
import {
  UploadOutlined,
  UserOutlined,
  VideoCameraOutlined,
} from '@ant-design/icons';

import { createBrowserRouter } from "react-router-dom"

import PrivateRoute from './PrivateRoute'
export const asyncRouter = [{
  path: "/",
  element: <PrivateRoute><LayoutIndex /></PrivateRoute>,
  icon: <VideoCameraOutlined />,
  title: "首页管理",
  children: [
    {
      element: <Home />,
      title: "首页信息",
      icon: <UploadOutlined />,
      index: true
    },
    {
      element: <About />,
      title: "大约信息",
      icon: <UserOutlined />,
      path: "/about",
    }
  ]
},
{
  path: "/rolesystem",
  element: <PrivateRoute><LayoutIndex /></PrivateRoute>,
  icon: <VideoCameraOutlined />,
  title: "角色管理",
  children: [
    {
      element: <RoleAdmin />,
      title: "角色分配",
      icon: <UploadOutlined />,
      path: "/rolesystem/roleadmin"
    },
    {
      element: <UserAdmin />,
      title: "用户分配",
      icon: <UserOutlined />,
      path: "/rolesystem/useradmin",
    }
  ]
},
{
  path: "/system",
  element: <PrivateRoute><LayoutIndex /></PrivateRoute>,
  icon: <VideoCameraOutlined />,
  title: "系统管理",
  children: [
    {
      element: <MenuAdmin />,
      title: "菜单分配",
      icon: <UploadOutlined />,
      path: "/system/menuadmin"
    },
    {
      element: <PowerAdmin />,
      title: "用户分配",
      icon: <UserOutlined />,
      path: "/system/poweradmin",
    }
  ]
}]


let routes: any = [
  {
    path: "/login",
    element: <Login />
  },
  ...asyncRouter,
  {
    path: "*",
    element: <NotFound />,
  }
]


export default createBrowserRouter(routes)